<script setup>

import {useUploadStore} from "@/stores/upload.js";
import {UploadFilled} from "@element-plus/icons-vue";
import {ElMessage} from "element-plus";

const uploadStore = useUploadStore()
function success(res) {
  if(res.code !== 200) {
    ElMessage({
      type: "error",
      message: res.msg,
    })
  }
}

</script>

<template>
  <el-dialog
    v-model="uploadStore.show"
    :close-on-press-escape="true"
    :title="uploadStore.title"
  >
    <el-upload
        drag
        multiple
        :action=uploadStore.url
        :on-success="success"
    >
      <el-icon class="el-icon--upload"><upload-filled /></el-icon>
      <div class="el-upload__text">
        Drop file here or <em>click to upload</em>
      </div>
    </el-upload>
  </el-dialog>
</template>

<style scoped>

</style>